<template>
    <div class="showleft">
        <div class="list-bottom"
             v-for="(item,index) in dataList"
             :key="index"
             @click="selectchange(item)">
            <div class="lefttrue">
                <div class="workselect">{{item.title}}</div>
                <div class="workdate">{{item.date|filterdata}}</div>
            </div>
            <div class="righrtrue">
                <div class="w-c-c">
                    <span :class="'toSqweqq'+item.mStatus">【{{item.mStatus |changemStatuslist}}】
                    </span>
                    <span :class="'toSqwe'+item.stateType"> 【{{item.stateType|changeTypelist}}】</span>
                </div>
                <div class="w-c-i">
                    <img src="../../../../static/images/5.png">
                </div>
            </div>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import myMenu from '@/commonComponents/menu'
export default {
    name: 'awaitMonitoring',
    data () {
        return {
            userInfo: {},
            showsearch: {},
            dataList: []
        }
    },
    components: {
        myMenu
    },
    created () {
        this.userInfo = JSON.parse(localStorage.userInfo)
        this.getData()
    },
    filters: {
        changeTypelist (val) {
            if (!val) {
                return false
            }
            if (val == 1) {
                return '未提交'
            } else if (val == 2) {
                return '待审批'
            } else if (val == 3) {
                return '已通过'
            } else if (val == 4) {
                return '未通过'
            }
        },
        changemStatuslist (val) {
            if (!val) {
                return false
            }
            if (val == 1) {
                return '待监控'
            } else if (val == 2) {
                return '已监控'
            }
        },
        filterdata (val) {
            if (!val) {
                return false
            }
            return val.substring(0, 10)
        }
    },
    methods: {
        getData () { // 获取列表数据
            this.$vux.loading.show({
                text: '加载中...'
            })
            let param = {
                'business': 'GetWorkInfoByType',
                'data': {
                    'type': '1', // type"0"标识待审批数据,"1"标识待监控数据
                    'deptid': this.userInfo.deptid,
                    'userid': this.userInfo.userid
                }
            }

            this.$axiosAjax.getConfigJson(
                param
            ).then(
                (res) => {
                    this.$vux.loading.hide()
                    this.dataList = res.data.data
                }
            )
        },
        selectchange (item) {
            if (item.type == 2) {
                if (item.stateType == 4) {
                    this.$router.push('/safework?id=' + item.id)
                }
                if (item.stateType == 2) {
                    //  if(this.safeallpeople){
                    this.$router.push('/safelook?id=' + item.id)
                    //  }
                }
                if (item.stateType == 3) {
                    this.$router.push('/safecontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }

            // 动火作业（一级、二三级）
            if (item.type == 1) {
                if (item.stateType == 2) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotworkApprove?id=' + item.id)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrepApprove?id=' + item.id)
                    }
                }
                if (item.stateType == 3) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrepMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                    }
                }
                if (item.stateType == 4) {
                    if (item.fireLevel == '一级动火') {
                        this.$router.push('/hotwork?id=' + item.id)
                    } else if (item.fireLevel == '二级动火' || item.fireLevel == '三级动火') {
                        this.$router.push('/hotworkrep?id=' + item.id)
                    }
                }
            }

            if (item.type == 3) {
                if (item.stateType == 4) {
                    this.$router.push('/construwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/construlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/construcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            // 高支模板拆除作业
            if (item.type == 4) {
                if (item.stateType == 2) {
                    this.$router.push('/formworkApprove?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/formworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                }
                if (item.stateType == 4) {
                    this.$router.push('/highformwork?id=' + item.id)
                }
            }
            if (item.type == 5) {
                if (item.stateType == 4) {
                    this.$router.push('/weightwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    this.$router.push('/weightlook?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/weightcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            // 交叉作业
            if (item.type == 6) {
                if (item.stateType == 4) {
                    this.$router.push('/crosswork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    this.$router.push('/crossworkApprove?id=' + item.id)
                }
                if (item.stateType == 3) {
                    this.$router.push('/crossworkMonitor?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            if (item.type == 7) {
                if (item.stateType == 4) {
                    this.$router.push('/boundedwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/boundedlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/boundedcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
            if (item.type == 8) {
                if (item.stateType == 4) {
                    this.$router.push('/electorwork?id=' + item.id)
                }
                if (item.stateType == 2) {
                    // if(this.jlpeople){
                    this.$router.push('/electorlook?id=' + item.id)
                    // }
                }
                if (item.stateType == 3) {
                    this.$router.push('/electorcontrol?id=' + item.id + '&mStatus=' + item.mStatus)
                }
            }
        }
    }
}
</script>
<style scoped>
.showleft {
    width: 100%;
    position: relative;
    padding-left: 20px;
}
.list-bottom {
    height: 82px;
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 20px 20px 20px 0;
    border-bottom: 1px solid #ccc;
}
.workselect {
    height: 14px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 14px;
    font-size: 14px;
    color: #333;
}
.workdate {
    height: 14px;
    line-height: 14px;
    font-size: 14px;
    color: #999;
    margin-top: 16px;
}
.righrtrue {
    display: flex;
}
.w-c-c {
    padding-top: 13px;
    color: #fe7234;
    margin-right: 10px;
    font-size: 13px;
}
.w-c-i {
    padding-top: 13px;
}
.toleft {
    background-color: #fff;
    padding-left: 20px;
}
.toSqwe1 {
    font-size: 14px;
}
.toSqwe2 {
    color: #333;
    font-size: 14px;
}
.toSqwe3 {
    color: green;
    font-size: 14px;
}
.toSqwe4 {
    color: red;
    font-size: 14px;
}
.toSqweqq1 {
    color: #333;
    font-size: 14px;
}
.toSqweqq2 {
    color: green;
    font-size: 14px;
}
</style>
